package com.honey.mybatis.generator.criteria.method;

import com.honey.compilation.java.Clazz;
import com.honey.compilation.java.Method;
import com.honey.compilation.java.Parameter;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.core.types.JDKFullyQualifiedJavaType;
import com.honey.mybatis.generator.MybatisPlugin;

public class AndNotInArrayMethod extends AndNotInMethod {

	private static final  Parameter FIRST_PARAMETER = new Parameter(JDKFullyQualifiedJavaType.getObjectInstance(),"...values");
	
	public AndNotInArrayMethod(){
	}

	public AndNotInArrayMethod(Clazz clazz, MybatisPlugin belongPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(clazz, belongPlugin, introspectSchema, introspectSchemaColumn);
	}
		
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.criteria.method.BaseMethod#getFirstParameter()
	 */
	@Override
	protected Parameter getFirstParameter() {
		return FIRST_PARAMETER;
	}
	
	@Override
	protected void addBody(Method method) {
		method.addBodyLine("List<Object> list = new ArrayList<Object>()");
		method.addBodyLine("for(Object obj : values )list .add(obj)");
		method.addBodyLine(method.getName()+"( field , list )");
		method.addBodyLine("return (T) this ");
	}

	public static void main(String []args){
		AndNotInArrayMethod  cm = new AndNotInArrayMethod();
		System.out.println(cm.createMethod().compiledContent(0)); 
	}
}
